﻿using Acme.BookStore.AcmeModel;
using Acme.BookStore.Management;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;

namespace Acme.BookStore
{
    /// <summary>
    /// 线路管理
    /// </summary>
    public class ManagementServer :
        CrudAppService<
            ManagementInfo, //The Book entity
            ManagementInfoDto, //Used to show books
            Guid, //Primary key of the book entity
            PagedAndSortedResultRequestDto, //Used for paging/sorting
            ManagementInfos>, //Used to create/update a book
        IManagementInfo //implement the IBookAppService
    {
        public IRepository<ManagementInfo, Guid> _Management;
        public IRepository<EnumInfo, Guid> _Enum;
        public ManagementServer(IRepository<ManagementInfo, Guid> Management, IRepository<EnumInfo, Guid> Enum)
            : base(Management)
        {
            _Management = Management;
            _Enum = Enum;
        }
        //显示
        public List<ManagementInfos> GetShow()
        {
            var str = (from a in _Management
                       join b in _Enum
                       on a.EnmuEid equals b.Id.ToString()
                       select new ManagementInfos
                       {
                           ManagementName = a.ManagementName,
                           ManagementRemark = a.ManagementRemark,
                           ManagementScore = a.ManagementScore,
                           ManagementTime = a.ManagementTime,
                           ManagementYn = a.ManagementYn,
                           ManagementZero = a.ManagementZero,
                           EnmuEid = a.EnmuEid,
                           CircuitType = b.CircuitType,
                       }).ToList();
            return str;
        }
    }
}
